// request => axios
import request from '@/utils/request'

export function getRoles(params) {
  return request({
    method: 'get',
    url: '/sys/role',
    params
  })
}

export function deleteRoleById(id) {
  return request({
    method: 'delete',
    url: '/sys/role/' + id
  })
}

export function addRole(data) {
  return request({
    method: 'post',
    url: '/sys/role',
    data
  })
}

export function updateRole(data) {
  return request({
    method: 'put',
    url: '/sys/role/' + data.id,
    data
  })
}

export function getRoleDetail(id) {
  return request({
    method: 'get',
    url: '/sys/role/' + id
  })
}

export function assignPermission(data) {
  return request({
    method: 'put',
    url: '/sys/role/assignPrem',
    data
  })
}
